Python Workbook: Learn How to Quickly and Effectively Program with Exercises, Projects, and Solutions by PROGRAMMING LANGUAGES ACADEMY

Python Workbook: Learn How to Quickly and Effectively Program with Exercises, Projects, and Solutions by PROGRAMMING LANGUAGES ACADEMY

Author:PROGRAMMING LANGUAGES ACADEMY [LANGUAGES ACADEMY, PROGRAMMING]
Language: eng
Format: azw3
Published: 2019-12-28T16:00:00+00:00


Is This Correct? - Part 4

Q-1: Below is a user-made function that is designed to iterate through a given range and look for the highest number. Will the function work when it is called?

def high_number(numbers):

​ max = numbers[0]

​ for number in numbers:

​ if number < max:

​ max = number

​ return max

list = [21, 200, 31, 1, 39]

high_number(list)

Q-2: What seems to be the issue with the following?

def this_function():

print("Hello From This Function!")

this_function_with_args(name, greeting):

print(f"Hello {name}, From This Function!, I wish you {greeting}")

this_function()

this_function_with_args()

Q-3: What would this function do?

def plus(a,b):

sum = a + b

(sum, a)

sum, a = plus(3,4)

print(sum)

Q-4: Can you place a loop within a function as shown below?

def plus(*args):

total = 0

for i in args:

​ total += i

return total

print(plus(20,30,40,50))

Now that we have revisited quite a few concepts and methods, and functions as well, let us head over to our final project and see what it is all about.

Final Project – Hangman

Remember the old game called Hangman? The one that involved blanks and a limited number of guesses to guess a movie, a name, a person, a city or something else? For your final project, I decided to come up with a tough one. A project that will use almost everything you have learned.

To make it even better, if you execute the program correctly, you can store it as a recallable function or create a separate package so that you can use this over and over again. While there are hundreds of variations for this game online, use your own unique approach. Feel free to browse the internet to get some inspiration.

Requirements:

You will need to use the following as your first line:

import time

Let this be a project that you are proud of, once it is finished. By the end of this project, rest assured you are ready to take on the challenges and offer some exquisite programming skills to those who require programmers such as yourself.

The journey of a programmer does not end here. There are far too many things that lay ahead which you will need to keep pace with. Learn about various libraries, modules and packages to see how they can bring refinement to your projects.

For those interested in Machine Learning, Automation, Artificial intelligence and Deep Learning, you will come across some names like Scikit-Learn, Turtle and a few more. While it is still too early to jump into these, it is a good idea to have a look at them and see how they perform in action.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.